// 自定义路由
// 自定义路由

//页面布局引入
import Index from '../layout/Index.vue'
import Login from '../layout/LoginLayout.vue'
// home 和 search
import Home from '../views/home/Home.vue'
import Search from '../views/search/Index.vue'



const routes = [
  {
    path: '/',
    component: Index,
    redirect:'/home',
    children:[
      { 
        //主页
        path:'/home', 
        name:'Home', 
        component:Home
      },
      {
        //搜索页
        path:'/search/:keyword?',
        name:'Search' ,
        component:Search
      },
      {
        //商品详情
        path:'/detail/:skuId',
        props:true,
        name:'Detail' ,
        component:() => import('@/views/detail')
      },
      {
        //购物车
        path:'/cart',
        name:'Cart' ,
        component:() => import('@/views/cart')
      },
      {
        //结页
        path:'/trade',
        component:() => import('@/views/trade')
      },
      {
        //提供给没有做功能的页面
        //待建设页面
        path:'/unPage',
        component:() => import('@/views/unPage')
      },
    ]
  },
  {
    path:'/login',
    component:Login,
    children:[
      {
        path:'',
        component:()=>import('@/views/login')
      }
    ]
  }
]

  // {path: '/about',
  //  component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }

export default routes
